package com.example.demo.entity;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import java.util.Arrays;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: RIKU
 * \* Date: 2020/5/25
 * \* Time: 17:26
 * \* To change this template use File | Settings | File Templates.
 * \* Description: //TODO
 * \
 */

@Component
@ConfigurationProperties(prefix = "neu.teacher")  //@ConfigurationProperties：只能对Spring中的组件使用,所以前面加了@Component
@Validated
public class Teacher {

    //@Value("${neu.teacher.name}")   //@Value("$(值的全名称)")：取单值
    private String name;
    //@Value("age")
    private int age;
    private String[] skill; //技能

    public String[] getSkill() {
        return skill;
    }

    public void setSkill(String[] skill) {
        this.skill = skill;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", skill=" + Arrays.toString(skill) +
                '}';
    }
}